package com.example.consume;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author anqi
 * @date 2021/8/11 15:03
 */
@Component
public class RabbitListen {

    @RabbitListener(queues = "check_sql_queue")
    public void receive(Message message, Channel channel) throws Exception {
        String sql = new String(message.getBody());
        System.out.println("接收sql:" + sql);
    }
}
